package com.jtlrm.ckd.mvp.model;

import com.base.sdk.base.model.BaseModel;
import com.base.sdk.base.net.LifeCycleEvent;
import com.google.gson.JsonObject;
import com.jtlrm.ckd.entity.submitEntity.AddYinShiData;
import com.jtlrm.ckd.entity.submitEntity.ChangeYinShiData;
import com.jtlrm.ckd.net.RetrofitUtil;

import io.reactivex.Observer;
import io.reactivex.subjects.PublishSubject;

public class YinShiMode extends BaseModel {
    public void querySevenYinShiData(String PatientId, Observer observer, PublishSubject<LifeCycleEvent> lifecycleSubject) {
        JsonObject jsonObject = new JsonObject();
        jsonObject.addProperty("PatientId", PatientId);
        RetrofitUtil.composeToSubscribe(RetrofitUtil.getService().querySevenYinShiData(jsonObject), observer, lifecycleSubject);
    }

    public void queryYongCanType(Observer observer, PublishSubject<LifeCycleEvent> lifecycleSubject) {
        RetrofitUtil.composeToSubscribe(RetrofitUtil.getService().queryYongCanType(), observer, lifecycleSubject);
    }

    public void queryYinShiDetail(String DietBodyId, Observer observer, PublishSubject<LifeCycleEvent> lifecycleSubject) {
        JsonObject jsonObject = new JsonObject();
        jsonObject.addProperty("DietBodyId", DietBodyId);
        RetrofitUtil.composeToSubscribe(RetrofitUtil.getService().queryYinShiDetail(jsonObject), observer, lifecycleSubject);
    }

    public void queryYinShiTuPian(String dietBodyId, Observer observer, PublishSubject<LifeCycleEvent> lifecycleSubject) {
        JsonObject jsonObject = new JsonObject();
        jsonObject.addProperty("dietBodyId", dietBodyId);
        RetrofitUtil.composeToSubscribe(RetrofitUtil.getService().queryYinShiTupian(jsonObject), observer, lifecycleSubject);
    }

    public void queryYinShiPic(String dietBodyId, String haveMealsTypeId, Observer observer, PublishSubject<LifeCycleEvent> lifecycleSubject) {
        JsonObject jsonObject = new JsonObject();
        jsonObject.addProperty("dietBodyId", dietBodyId);
        jsonObject.addProperty("haveMealsTypeId", haveMealsTypeId);
        RetrofitUtil.composeToSubscribe(RetrofitUtil.getService().queryYinShiPic(jsonObject), observer, lifecycleSubject);
    }

    public void queryShiWuType(Observer observer, PublishSubject<LifeCycleEvent> lifecycleSubject) {
        RetrofitUtil.composeToSubscribe(RetrofitUtil.getService().queryShiWuType(), observer, lifecycleSubject);
    }

    public void queryShiWuALl(Observer observer, PublishSubject<LifeCycleEvent> lifecycleSubject) {
        RetrofitUtil.composeToSubscribe(RetrofitUtil.getService().queryAllFood(), observer, lifecycleSubject);
    }

    public void addYinShi(AddYinShiData data, Observer observer, PublishSubject<LifeCycleEvent> lifecycleSubject) {
        RetrofitUtil.composeToSubscribe(RetrofitUtil.getService().addYinShi(createBody(data)), observer, lifecycleSubject);
    }

    public void changeYinShi(ChangeYinShiData data, Observer observer, PublishSubject<LifeCycleEvent> lifecycleSubject) {
        RetrofitUtil.composeToSubscribe(RetrofitUtil.getService().changeYinShi(createBody(data)), observer, lifecycleSubject);
    }

    public void deleteYinShi(String id, Observer observer, PublishSubject<LifeCycleEvent> lifecycleSubject) {
        JsonObject jsonObject = new JsonObject();
        jsonObject.addProperty("id", id);
        RetrofitUtil.composeToSubscribe(RetrofitUtil.getService().deleteYinShi(jsonObject), observer, lifecycleSubject);
    }

    public void queryThreeYinShiData(String PatientId, Observer observer, PublishSubject<LifeCycleEvent> lifecycleSubject) {
        JsonObject jsonObject = new JsonObject();
        jsonObject.addProperty("PatientId", PatientId);
        RetrofitUtil.composeToSubscribe(RetrofitUtil.getService().queryThreeYinShiData(jsonObject), observer, lifecycleSubject);
    }
}
